package com.gp.dwt.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

/**
 * @author 小杜
 * @description: 邮箱发送验证码
 * @created 2024-04-28 18:05
 */
@Component
public class JavaMailTool {
    @Autowired
    private JavaMailSender mailSender;

    public void sendEmail(String email_to, String verifycode) {
        SimpleMailMessage mailMessage = new SimpleMailMessage();
        mailMessage.setFrom("554959937@qq.com");
        mailMessage.setTo(email_to);
        mailMessage.setSubject("验证码");
        mailMessage.setText("你的注册验证是 : " + verifycode);
        mailSender.send(mailMessage);
    }
}